<template>
	<view class="container" v-if="jumpType!==1">
		<view class="order-status">
			{{ orderDetail.status == 0 ? '已取消' : orderDetail.status == 1 ? '等待雇员接单' : orderDetail.status == 2 ? '待开工' : orderDetail.status == 3 ? '进行中' : orderDetail.status == 4 ? '待结算' : orderDetail.status == 9 ? '待同意' :  orderDetail.status == 5 ? '已完成' : orderDetail.status == 7 ? '等待雇员同意' : orderDetail.status == 8 ? '等待雇主开工确认' : ''}}
		</view>
		<view class="main"
			:style="{'margin-bottom': orderDetail.status != 1 && orderDetail.status != 0 && orderDetail.status != 4 ? '130rpx' : 0}">
			<!-- 雇主的订单详情 -->
			<view class="info employer-area">
				<view class="title">雇员</view>
				<view class="employer-info" @click="handleOpenStaffDetail(orderDetail.userId)">
					<view>
						<view class="avatar"
							:class="[orderDetail.taskUser.userIdentityStatus==0&&'avatar-pic-vip1',orderDetail.taskUser.userIdentityStatus==1&&'avatar-pic-vip2',orderDetail.taskUser.userIdentityStatus==2&&'avatar-pic-vip2',]"
							:style="{top: orderDetail.taskUser.user.vipFlag ? (10 +'rpx') : 0}">
							<image class="image" :src="imgPath + orderDetail.taskUser.user.avatar" mode="aspectFill">
							</image>
							<!-- <image v-if="orderDetail.taskUser.user.vipFlag" class="crown" src="/static/crown.png" mode="aspectFill"></image> -->
							<!-- 		<view v-if="orderDetail.taskUser.user.vipFlag" class="vip-crown">
								<image src="@/static/icon3/adasdasd.png" mode="aspectFill"></image>
								<text>金牌</text>
							</view> -->
						</view>
						<view>
							<view>
								<text>{{ orderDetail.taskUser.user.userName }}</text>
								<!-- <image :src="orderDetail.taskUser.user.sex==1 ? '/static/icon1/21.png' : '/static/icon1/55.png'" mode="aspectFill"></image> -->
								<view v-if="orderDetail.taskUser.user.sex==0" class="sex-nan">
									<image class="sex-image" src="@/static/icon3/nna1111.png" mode="aspectFill"></image>
									{{!orderDetail.taskUser.user.age ? '未知' : orderDetail.taskUser.user.age}}
								</view>
								<view v-if="orderDetail.taskUser.user.sex==1" class="sex-nv">
									<image class="sex-image" src="@/static/icon3/nv111.png" mode="aspectFill"></image>
									{{!orderDetail.taskUser.user.age ? '未知' : orderDetail.taskUser.user.age}}
								</view>
							</view>
							<!-- <view>
								<text>诚信值</text>
								<text>{{ orderDetail.taskUser.integrity }}</text>
							</view> -->
							<view class="cxDiv">
								<view class="cx">
									<text style="margin-right: 0;">评分</text>
									<text>{{ orderDetail.taskUser.employeeRating}}</text>
								</view>
								<text class="fg">|</text>
								<view class="cx">
									<text style="margin-right: 0;">好评率</text>
									<text>{{ orderDetail.taskUser.user.haoping }}%</text>
								</view>
							</view>
						</view>
					</view>
					<view>
						<text>成交单数</text>
						<text>{{ orderDetail.taskUser.receiveNum }}</text>
					</view>
				</view>
				<view class="buttons" v-if="chatFlag==true">
					<view class="button" @click="handOpenChat">在线聊天</view>
					<view class="button" @click="handleMakePhoneCall">拨打电话</view>
				</view>
			</view>
			<!-- 干活信息 -->
			<view class="info job-info">
				<view class="title">干活信息</view>
				<view class="job-detail">
					<view @click="handleMap">
						<text>干活地点</text>
						<view>{{ orderDetail.taskAddress }}</view>
					</view>
					<view>
						<text>干活时间</text>
						<view>{{ orderDetail.startTime ? orderDetail.startTime.slice(0, 16) : '' }} —
							{{ orderDetail.endTime ? orderDetail.endTime.slice(10, 16) : ''}}
						</view>
						<!-- <text>{{ orderDetail.taskStartTime.slice(0, 16) }} —{{ orderDetail.taskEndTime.slice(10, 16) }}</text> -->
					</view>
					<view>
						<text>需要人数</text>
						<text>{{ orderDetail.taskNumber }}人</text>
					</view>
					<view
						v-if="orderDetail.taskType == 1&&(orderDetail.status==0||orderDetail.status==4||orderDetail.status==5)">
						<text>完成件数</text>
						<text>{{ orderDetail.finishCount ? orderDetail.finishCount : 0 }}件</text>
					</view>
					<!-- 计件的保底工时 -->
					<!-- 	<view class="" v-if="orderDetail.taskType===1">
						<text>保底时薪</text>
						<text>{{orderDetail.floorsAmountY}}元/小时</text>
					</view> -->
					<view v-if="orderDetail.status==0||orderDetail.status==4||orderDetail.status==5">
						<text>工资小计</text>
						<text>{{ orderDetail.finishAmount ? orderDetail.finishAmount : 0 }}元</text>
					</view>
				</view>
				<view style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
					<view class="job-name">
						<view style="font-weight: bold;">{{ orderDetail.taskName }}</view>
						<view style="font-weight: bold;">
							{{ orderDetail.rewardY }}{{ orderDetail.taskType===0 ? '元/小时' : orderDetail.taskType===1 ? '元/件' : orderDetail.taskType===2 ? '元/天' : ''}}<text
								v-if="taskDetail.floorsstr==1"
								class="floorsstr-view">保底{{taskDetail.floorsAmount/100}}元/小时</text>
						</view>
					</view>
					<view class="job-name" v-if="myTyTime>0 && isShowDaijis" style="font-weight: 0;">
						<count-down-circle ref="countDown" :second="myTyTime/1000" :second2="myTyTime" type='circle'
							@end="endDjs"> </count-down-circle>
					</view>
				</view>
				<!-- 服务费率为0时，不展示 -->
				<view class="tip" v-show="rate">
					<view>
						<text>温馨提示</text>
					</view>
					<text>注: 平台将抽取{{rate}}%的服务费</text>
				</view>
			</view>
			<!-- 订单信息 -->
			<view class="info order-info">
				<view class="title">订单信息</view>
				<view>
					<text>创建时间</text>
					<text>{{ orderDetail.createTime }}</text>
				</view>
				<view>
					<text>订单编号</text>
					<text>{{ orderDetail.orderNo }}</text>
				</view>
			</view>
		</view>
		<!-- 按钮 v-show="false"-->
		<view class="fix-buttons" v-if="orderDetail.status != 0  && orderDetail.isEmployerEvaluate !=1"
			:style="{height: orderDetail.status==2?'110rpx':'','background-color':myTyTime>0 &&isShowDaijis?'#F2F2F2':''}">
			<!-- <view @click.stop="handleRecevieButton(0)" class="button" v-if="orderDetail.status == 1">拒绝</view>
			<view @click.stop="handleRecevieButton(1)" class="button" v-if="orderDetail.status == 1">同意</view> -->
			<view class="fix-buttons2" :style="{width:myTyTime>0 &&isShowDaijis?'100%':''}">
				<view class="zdy-ju-left" v-if="myTyTime>0 &&isShowDaijis" @click="handleTykg('REJECT',orderDetail.id)">
					拒绝 </view>
				<view class="zdy-ju-right" v-if="myTyTime>0 &&isShowDaijis"
					@click="handleTykg('PASSED',orderDetail.id)"> 同意雇员开工 </view>
				<view @click.stop="kaichu2(orderDetail.id)" class="button"
					:style="{'border-style':myTyTime==0?'none':'none'}"
					style="width: 160rpx;height:58rpx;display: flex;justify-content: center;align-items: center;border-radius: 40rpx;color: #ABABAB;border-width: 1px;border-color: #ccc;color: rgb(120, 120, 120);background-color: #fff;"
					v-show="orderDetail.status != 1 && orderDetail.status != 5 && orderDetail.status != 4 && orderDetail.isExpel==true">
					开除</view>
				<view class="nullListMsg" v-if="myTyTime>0 && isShowDaijis">
					<view>倒计时结束，开工申请自动同意</view>
					<view></view>
				</view>
			</view>
			<view @click.stop="handleRecevieButton(3)" class="button comment"
				v-if="orderDetail.status == 5&&orderDetail.isEmployerEvaluate==0">评价</view>
			<view @click.stop="handleRecevieButton(11,orderDetail.status, orderDetail.id)" class="button"
				v-if="orderDetail.status == 3&&orderDetail.taskType == 0&&level==2">收工</view>
			<view @click.stop="handleRecevieButton(12,orderDetail.status, orderDetail.id)" class="button"
				v-if="orderDetail.status == 9&&orderDetail.taskType == 0&&level==2">驳回 00:{{countdown}}</view>
			<!-- 	<view @click.stop="handleRecevieButton(4)" class="button" v-if="orderDetail.status == 8">拒绝开工</view>
			<view @click.stop="handleRecevieButton(5)" class="button"  v-if="orderDetail.status == 8">确认开工</view> -->
			<!-- <view @click.stop="handleRecevieButton(6, orderDetail.taskUser.user.userName)" class="button" v-if="orderDetail.status == 4">结算</view> -->
			<view @click.stop="handleRecevieButton(7)" class="button"
				v-if="orderDetail.status == 4 && orderDetail.taskType == 1">修改件数</view>
		</view>
		<!-- <view class="fix-buttons" v-if="orderDetail.status == 0&&orderDetail.report==0">
			<view @click.stop="handleRecevieButton(13,orderDetail.status, orderDetail.id)" class="button">举报</view>
		</view> -->
		<!-- 弹窗 -->
		<modal :isShowModal="isShowModal" :modalStytle="modalStytle" :unitPrice="unitPrice" :workTime="workTime"
			:workPrice="workPrice" :jobType="jobType" @input="handleInput" @handleLeft="handleLeft"
			@handleRight="handleRight" :titleContect="titleContect" :middleContext="middleContext"
			:leftContext="leftContext" :rightContext="rightContext"></modal>
		<kaichu v-if="isShowKaiChu" :type="kaichuType" @closeKaichu="closekC()" @kaichu="kaichu"></kaichu>
	</view>
</template>
<script>
	import chat from '@/libs/chat.js'
	import format from '@/libs/day-format.js'
	import modal from '@/components/modal/modal.vue'
	import {
		he_evaluate_lv,
		isResidueTimeByMinute,
	} from '@/libs/unit.js'
	import phoneLimite from '@/libs/function/phoneLimite.js' //判断是否有拨打电话权限sssssss
	import unit from '@/libs/newUnit.js'
	import kaichu from '@/components/xjbg/kaichu.vue'
	import countDownCircle from '@/components/e-countDownCircle/e-countDownCircle.vue'
	export default {
		components: {
			modal,
			kaichu,
			countDownCircle
		},
		data() {
			return {
				countdown: 0,
				level: 1,
				serverFlag: 0, //0不用付服务费，1付服务费
				count: '', //收工雇员输入的计件件数
				toDay: '', //当前时间
				x_hours_no_order: '', //雇员取消x小时内不可接单
				order_user_cancel_cut_integrity: '', //雇员取消订单扣除诚信值
				modalStytle: 3, //0-left-text,1-two-line,2-hasInput, 3-middle-context
				isShowModal: false, //是否显示弹框
				titleContect: '', //弹框标题
				middleContext: '', //弹框中间的内容
				unitPrice: 0, //计件单价
				workTime: '0', //计时工作时间
				workPrice: 0, //工作单价
				leftContext: '取消', //弹框按钮左边的内容
				rightContext: '确认', //弹框按钮右边的内容
				button: 1, //按钮类型
				// clickStatus: 0,//工作状态
				jobType: 0, //工作类型0计时工，1：计天工，2计件工
				rate: 4, //平台将抽取的服务费率
				id: '', //订单id
				imgPath: '', //图片路径slice
				orderDetail: { //订单详情
					taskStartTime: '',
					taskEndTime: '',
					taskUser: {
						user: {
							haoping: 0
						},
					},
				},
				taskDetail: {}, //任务详情
				singleSincerityGold: '', //单人结算保证金
				orderAmount: '', //单个订单金额
				chatFlag: true, //展示聊天框
				isShowKaiChu: false,
				kaichuType: 0,
				jumpType: 0,
				isShowDaijis: false,
				myTyTime: 0,
			}
		},
		methods: {
			// 获取用户输入的件数
			handleInput(value) {
				this.count = value
			},
			closeKgR() {
				this.refresh()
			},
			invitationCountDown(time) {
				let date = new Date(time.replace(/-/g, '/'))
				let time1 = Date.parse(date) / 1000
				let time2 = time1 + 900
				let time3 = Date.parse(new Date()) / 1000
				let time4 = (time2 - time3)
				this.myTyTime = time4 * 1000 > 0 ? time4 * 1000 : 0
			},
			endDjs() {
				this.isShowDaijis = false
				this.myTyTime = 0
				setTimeout(() => {
					this.refresh()
				}, 10)
			},
			async handleTykg(type, orderId) {
				let res = await this.$fetch(this.$api.confirm_work, {
					orderId: orderId,
					applyTaskStatus: type
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.myTyTime = 0
				this.isShowDaijis = false
				setTimeout(() => {
					this.refresh()
				}, 10)
			},
			//打开地图
			handleMap() {
				uni.navigateTo({
					url: '/pages/map-job/map-job?lat=' + this.taskDetail.lat + '&lng=' + this.taskDetail.lng +
						'&address=' + this.taskDetail.address + '&name=' + this.taskDetail.name,
				})
			},
			// 打开雇员详情
			handleOpenStaffDetail(id) {
				uni.navigateTo({
					url: '/pages/employer-detail/employee-detail?staffId=' + id + '&jumpType=1'
				})
			},
			//聊天
			handOpenChat(id) {
				let lat = uni.getStorageSync('location')[0]
				let lng = uni.getStorageSync('location')[1]
				let address = uni.getStorageSync('currentAddress')
				let tempGuInfo = {
					userId: this.orderDetail.taskUser.user.userId,
					userName: this.orderDetail.taskUser.user.userName,
					userAvatar: this.orderDetail.taskUser.user.avatar
				}
				let taskinfo = {
					orderId: this.id,
					taskTime: this.orderDetail.taskStartTime,
					taskName: this.orderDetail.taskName,
					taskAddress: this.orderDetail.taskAddress,
					integrity: this.orderDetail.taskUser.integrity,
					gongJia: this.orderDetail.rewardY,
					danwei: this.orderDetail.taskType === 0 ? '元/小时' : this.orderDetail.taskType === 1 ? '元/件' : this
						.orderDetail.taskType === 2 ? '元/天' : '',
					floorsstr: this.taskDetail.floorsstr,
					baoDi: this.taskDetail.floorsAmount ? this.taskDetail.floorsAmount / 100 : ''
				}
				let guObj = JSON.stringify(tempGuInfo);
				uni.navigateTo({
					url: "/pages/he-chat/HE-chat?form=" + guObj + '&taskinfo=' + JSON.stringify(taskinfo) +
						"&stu=true"
				})
				// chat('zlg_' + this.orderDetail.taskUser.user.userId, this.orderDetail.taskUser.user.userName, lat, lng, address)
			},
			// 拨打电话
			handleMakePhoneCall() {
				if (this.orderDetail.taskUser.user == {} || this.id == "") {
					setTimeout(() => {
						this.handleMakePhoneCall()
					}, 2000)
				} else {
					this.phone_bind_middle_number(this.orderDetail.taskUser.user.phonenumber, this.id)
				}
			},
			//获取虚拟电话
			async phone_bind_middle_number(telephone, id) {
				let isTruePhone = false
				let cont = "是否拨打电话"
				let phone = telephone
				let res = await this.$fetch(this.$api.phone_bind_middle_number, {
					phone: telephone,
					orderId: id
				}, 'POST', 'form')
				console.log('获取虚拟电话res~~~~~~', res)
				// if (res.code) return uni.showToast({
				// 	title: res.msg,
				// 	icon: 'none'
				// })
				if (res.code == '500') {
					console.log("sadawq3e4")
					isTruePhone = true
				} else if (res.data.overTime == '1000') {
					isTruePhone = true
				}
				if (isTruePhone) {
					cont = '是否拨打电话' + phone
				} else {
					cont = '此号码是平台虚拟电话，请不要重复拨打！'
					phone = res.data.middleNumber
				}
				uni.showModal({
					title: '提示',
					content: cont,
					success: (re) => {
						if (re.confirm) {
							phoneLimite(phone)
						} else if (re.cancel) {
							// console.log('用户点击取消')
						}
					}
				})
			},
			async cateTotalGoodEvaluateLv(userId) {
				let res = await this.$fetch(this.$api.cateTotalGoodEvaluateLv, {
					userId
				}, 'GET')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.$set(this.orderDetail.taskUser.user, 'haoping', res.data)
			},
			// 获取订单详情
			async order_detail() {
				// console.log('this.id', this.id)
				let res = await this.$fetch(this.$api.order_detail, {
					orderId: this.id
				}, 'POST')
				console.log('雇主订单详情', res)
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				// 整理数据,res.data.user为null，则改为""
				Object.getOwnPropertyNames(res.data).forEach(function(key) {
					res.data[key] = res.data[key] == null ? '' : res.data[key]
				})
				// 将金额除以100，单位变为元
				res.data.floorsAmountY = res.data.floorsAmount ? res.data.floorsAmount.divide(100) : 0
				res.data.rewardY = res.data.reward.divide(100)
				res.data.taskUser.integrity = parseFloat(res.data.taskUser.integrity).divide(100)
				res.data.finishAmount = res.data.finishAmount ? res.data.finishAmount.divide(100) : 0
				// this.cateTotalGoodEvaluateLv(res.data.userId)
				await he_evaluate_lv(res.data.taskUser.user.userId).then((v) => {
					res.data.taskUser.user.haoping = v
				})
				//old好评率算法
				// let haoping = uni.getStorageSync('heEvaluateLv') ? uni.getStorageSync('heEvaluateLv') : []
				// if (haoping.indexOf(res.data.taskUser.user.userId) != -1) {
				// 	res.data.taskUser.user.haoping = haoping[haoping.indexOf(res.data.taskUser.user.userId) + 1]
				// } else {
				// 	await he_evaluate_lv(res.data.taskUser.user.userId).then((v) => {
				// 		res.data.taskUser.user.haoping = v
				// 	})
				// }
				this.orderDetail = res.data
				if (this.orderDetail.applyTime && this.orderDetail.applyState == 1) {
					this.invitationCountDown(this.orderDetail.applyTime)
					this.isShowDaijis = true
				}
				if (this.jumpType == 1) {
					// console.log(this.orderDetail)
					this.handleOpenStaffDetail(this.orderDetail.userId)
					this.jumpType = 0
					return
				}
				if (this.orderDetail.status == 2) {
					this.orderDetail.isExpel = 15 > (isResidueTimeByMinute(this.orderDetail.createTime) * -1)
				}
				if (this.orderDetail.status == 3) {
					this.orderDetail.isExpel = this.orderDetail.expel_time > (isResidueTimeByMinute(this.orderDetail
						.startTime) * -1)
				}
				this.task_detail(this.orderDetail.taskId)
				// 聊天框展示
				if (this.orderDetail.status == 5) {
					this.chatFlag = this.calcWorkTime(this.orderDetail.updateTime) > 2 ? false : true
					console.log('聊天this.chatFlag', this.chatFlag)
				} else if (this.orderDetail.status == 0) {
					this.chatFlag = false
				}
			},
			// 计算完成订单时长
			calcWorkTime(end) {
				let endT = end.replace(/-/g, '/')
				let today = new Date().getTime()
				endT = new Date(endT).getTime()
				console.log('完成订单时间', end, endT, '当前时间', today)
				let differenceT = (today - endT) / (1000 * 60 * 60) //小时
				console.log('时间差', differenceT)
				return differenceT
			},
			// 获取任务详情
			async task_detail(taskId) {
				let res = await this.$fetch(this.$api.task_detail, {
					taskId: taskId
				}, 'POST')
				this.taskDetail = res.data
				// 是否是缴纳服务费的任务
				this.serverFlag = res.data.serverFlag
				this.singleSincerityGold = (res.data.sincerityGold / res.data.number).toFixed(1)
			},
			//接单按钮
			handleRecevieButton(button, name, orderId) {
				console.log('button', button, 'status', this.orderDetail.status, 'orderId', this.orderDetail.id)
				this.button = button
				if (button == 0) {
					// 拒绝
					this.modalStytle = 3
					this.titleContect = '拒绝雇员'
					this.middleContext = ' 是否拒绝雇员？'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 1) {
					// 同意
					this.modalStytle = 3
					this.titleContect = '同意雇佣'
					this.middleContext = ' 是否同意雇佣？'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 2) {
					// 开除
					this.kaichuType = this.orderDetail.status == 2 ? 0 : this.orderDetail.status == 3 ? 1 : 0
					// this.isShowKaiChu = true
					// this.modalStytle = 3
					// this.titleContect = '开除雇员'
					// this.middleContext = ' 是否开除雇员？'
					// this.leftContext = '取消'
					// this.rightContext = '确认'
					this.kaichu(orderId)
					// this.isShowModal = true
				} else if (button == 3) {
					// 评价
					uni.navigateTo({
						url: '/pages/comment/comment?orderId=' + this.orderDetail.id + '&type=' + 0
					})
				} else if (button == 4) {
					// 拒绝开工 
					this.modalStytle = 3
					this.titleContect = '拒绝开工'
					this.middleContext = ' 是否拒绝开工？'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 5) {
					// 确认开工
					this.modalStytle = 3
					this.titleContect = '确认开工'
					this.middleContext = ' 是否确认开工？'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 6) {
					// 结算
					this.modalStytle = 3
					this.titleContect = '结算单人工资'
					this.middleContext = ' 是否结算' + name + '的工资？'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 7) {
					// 修改件数
					this.modalStytle = 2
					this.unitPrice = this.orderDetail.reward.divide(100)
					this.titleContect = '修改件数'
					this.leftContext = '取消'
					this.rightContext = '确认'
					this.isShowModal = true
				} else if (button == 11) { //收工
					// 修改件数
					this.shougong(orderId)
					uni.showToast({
						title: '已收工~',
						icon: 'none'
					})
				} else if (button == 12) { //驳回
					this.bohui(orderId)
					return uni.showToast({
						title: '已驳回~',
						icon: 'none'
					})
				} else if (button == 13) {
					uni.navigateTo({
						url: '/pages/jubao/jubao?orderId=' + orderId
					})
					// console.log('sadasdsa',name, orderId)
				}
			},
			kaichu2(e) {
				uni.navigateTo({
					url: '/pages/kaichu/kaichu?xiangqing=true&orderId=' + e + '&type=' + 0
				})
			},
			//弹框左键
			handleLeft() {
				this.isShowModal = false
			},
			async shougong(orderId) {
				console.log("收工")
				let res = await this.$fetch(this.$api.order_user_end, {
					orderId: orderId,
					status: 4,
					count: -1
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.refresh()
			},
			async bohui(orderId) {
				console.log("驳回收工")
				clearInterval(this.timer)
				let res = await this.$fetch(this.$api.order_user_end, {
					orderId: orderId,
					status: 2,
					count: -1
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.refresh()
			},
			async queren(orderId) {
				console.log("确认收工")
				//	let res = await this.$fetch(this.$api.order_user_end,{orderId: orderId,status:3, count: -1 }, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.refresh()
			},
			//弹框右键
			async handleRight() {
				this.isShowModal = false
				if (this.button == 0) { //拒绝
					let res = await this.$fetch(this.$api.apply_check, {
						orderId: this.orderDetail.id,
						checkStatus: 0
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.showToast({
						title: '已拒绝~',
						icon: 'none'
					})
				} else if (this.button == 1) { //同意雇员接单接单
					let res = await this.$fetch(this.$api.apply_check, {
						orderId: this.orderDetail.id,
						checkStatus: 2
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.showToast({
						title: '已同意~',
						icon: 'none'
					})
				} else if (this.button == 2) { //开除
					let res = await this.$fetch(this.$api.task_user_expel, {
						orderId: this.orderDetail.id
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.$emit('closeWorking', {})
					uni.showToast({
						title: '已开除~',
						icon: 'none'
					})
				} else if (this.button == 3) { //开除
					let res = await this.$fetch(this.$api.task_user_expel, {
						orderId: this.orderDetail.id
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.showToast({
						title: '已开除~',
						icon: 'none'
					})
					uni.$emit('closeWorking', {})
				} else if (this.button == 4) { //拒绝开工
					let res = await this.$fetch(this.$api.task_user_refuse_start, {
						orderId: this.orderDetail.id
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.showToast({
						title: '已拒绝开工~',
						icon: 'none'
					})
					uni.$emit('closeWorking', {})
				} else if (this.button == 5) { //确认开工
					let res = await this.$fetch(this.$api.task_user_confirm_start, {
						orderId: this.orderDetail.id
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.showToast({
						title: '已确认开工~',
						icon: 'none'
					})
				} else if (this.button == 6) { //单个结算
					console.log('this.orderDetail.id', this.orderDetail.id)
					uni.navigateTo({
						url: '/pages/app-employer/boss-settlement/boss-settlement?type=single&orderId=' + this
							.orderDetail.id + '&taskId=' + this.orderDetail.taskId + '&singleSincerityGold=' +
							this.singleSincerityGold + '&orderAmount=' + this.orderAmount + '&serverFlag=' +
							this.serverFlag
					})
					// uni.navigateTo({
					// 	url: '/pages/app-employer/boss-settlement/boss-settlement?type=single&orderId='+ this.orderDetail.id + '&taskId=' + this.orderDetail.taskId + '&singleSincerityGold=' + this.singleSincerityGold + '&orderAmount=' + this.orderAmount
					// })
				} else if (this.button == 7) { //修改件数
					console.log('this.orderDetail.id', this.orderDetail.id)
					// if(this.count == 0) return uni.showToast({ title: '请输入件数~', icon: 'none' })
					let res = await this.$fetch(this.$api.upd_piece_num_by_id, {
						orderId: this.orderDetail.id,
						count: this.count
					}, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
				}
				this.order_detail()
			},
			// 配置数据
			async getRate() {
				let res = await this.$fetch(this.$api.property_list_by_type, {
					type: 1
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				//收取雇员百分之手续费
				uni.setStorageSync('user_amount_ratio', res.data.user_amount_ratio)
				this.rate = res.data.user_amount_ratio * 100
				// 雇员取消订单扣除诚信值
				uni.setStorageSync('order_user_cancel_cut_integrity', res.data.order_user_cancel_cut_integrity)
				this.order_user_cancel_cut_integrity = uni.getStorageSync('order_user_cancel_cut_integrity')
				// 雇员取消订单扣除诚信值
				uni.setStorageSync('order_user_cancel_cut_integrity', res.data.order_user_cancel_cut_integrity)
				this.x_hours_no_order = uni.getStorageSync('x_hours_no_order')
			},
			getr() {
				if (this.orderDetail.status == 9) {
					this.countdown = 60
					this.timer = setInterval(() => {
						if (this.countdown == 0) {
							this.bohui(this.orderDetail.id)
							clearInterval(this.timer)
						}
						var st = uni.getStorageSync("countdowns")
						if (this.countdown > st) {
							this.countdown = st
						}
						this.countdown = --this.countdown
						uni.setStorageSync("countdowns", this.countdown)
						//console.log('item.countdown',this.countdown)
					}, 1000)
				}
			},
			closekC() {
				this.isShowKaiChu = false
			},
			kaichu(string) {
				if (string) {
					unit.postOrder_senddown(this.orderDetail.id, string).then(v => {
						if (v.code) {
							uni.showToast({
								title: v.msg,
								icon: 'none'
							})
						}
					})
				}
				this.handleRight()
				this.isShowKaiChu = false
			},
		},
		onLoad(options) {
			this.id = options.id
			this.jumpType = options.jumpType ? options.jumpType : 0
			this.order_detail()
			this.orderAmount = options.orderAmount
			this.imgPath = uni.getStorageSync('imgPath')
			this.level = uni.getStorageSync('level')
			this.countdown = uni.getStorageSync("countdowns")
			this.getr()
		},
		onPullDownRefresh() {
			setTimeout(() => {
				// this.refresh()
			}, 10)
			uni.stopPullDownRefresh()
		},
		onShow() {
			uni.$on('closeKgR', this.closeKgR)
			this.getRate()
		}
	}
</script>
<style lang="less">
	.container {
		border-top: 1px solid #FCC928; //不能删，ios会报损
		border-bottom: 1px solid #FCC928; //不能删，ios会报损
		border-bottom-color: rgba(252, 201, 40, 0); //不能删，ios会报损

		// border: 1px solid rgba(252,201,40,0);
		&>.order-status {
			font-size: 22px;
			line-height: 60rpx;
			padding: 20rpx 0 114rpx 30rpx;
			background-color: #FCC928;
		}

		&>.main {
			margin-top: -84rpx;

			&>.info {
				z-index: 1;
				margin: 0rpx 30rpx 30rpx;
				padding: 30rpx;
				border-radius: 7px;
				background-color: #FFFFFF;

				&>.title {
					margin-bottom: 20rpx;
					height: 40rpx;
					font-weight: bold;
				}
			}

			&>.employer-area {
				&>.employer-info {
					padding-bottom: 30rpx;
					margin: 0rpx 0 30rpx;
					border-bottom: 1px solid #F2F2F2;
					display: flex;
					align-items: center;
					justify-content: space-between;

					&>view {
						display: flex;

						&>.avatar {
							position: relative;
							display: flex;
							flex-direction: column;
							align-items: center;
							margin-right: 30rpx;

							&>.avatar-pic {
								width: 108rpx;
								height: 108rpx;
								border-radius: 50%;
							}

							&>.crown {
								// border: 1px solid #55aa7f;
								position: absolute;
								left: -10rpx;
								top: -40rpx;
								width: 78rpx;
								height: 59rpx;
							}
						}

						&>view {
							display: flex;
							// justify-content: center;
							flex-direction: column;

							&>view:first-child {
								display: flex;
								align-items: center;
								// justify-content: center;
								margin-bottom: 20rpx;

								&>text {
									margin-right: 20rpx;
									height: 48rpx;
									font-size: 17px;
								}

								&>image {
									align-self: flex-end;
									width: 26rpx;
									height: 26rpx;
								}
							}

							&>view:last-child {
								// border: 1px solid #007AFF;
								height: 40rpx;
								display: flex;
								align-items: center;

								text:first-child {
									margin-right: 30rpx;
									color: rgba(64, 33, 16, 0.70);
								}

								text:last-child {
									font-weight: bold;
								}
							}
						}
					}

					&>view:last-child {
						flex-direction: column;
						text-align: right;

						&>text:first-child {
							margin-bottom: 2rpx;
							height: 34rpx;
							font-size: 12px;
							color: rgba(64, 33, 16, 0.70);
						}

						&>text:last-child {
							height: 60rpx;
							font-weight: bold;
							font-size: 22px;
							color: #F39B19;
						}
					}
				}

				&>.buttons {
					display: flex;
					justify-content: space-between;

					&>.button {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 300rpx;
						height: 80rpx;
						background-color: #F39B19;
						border-radius: 4px;
					}

					&>.button:first-child {
						background-color: #FCC928;
					}
				}
			}

			&>.job-info {
				&>.job-detail {
					border-bottom: 1px solid #F2F2F2;
					padding-bottom: 30rpx;

					&>view {
						display: flex;
						margin-bottom: 20rpx;

						text {
							letter-spacing: 0;
						}

						text:first-child {
							white-space: nowrap;
							margin-right: 30rpx;
							color: rgba(64, 33, 16, 0.50);
						}

						text:last-child {
							display: flex;
						}
					}

					&>view:last-child {
						margin-bottom: 0rpx;
					}
				}

				.job-name {
					margin-top: 30rpx;

					&>view {
						font-size: 17px;
						letter-spacing: 0;
					}

					&>view:last-child {
						margin-top: 20rpx;
						color: #F39B19;
					}
				}

				&>.tip {
					border-top: 1px solid #F2F2F2;
					margin-top: 30rpx;
					padding-top: 30rpx;

					text {
						font-size: 14px;
						color: rgba(64, 33, 16, 0.50);
						letter-spacing: 0;
					}

					&>view {
						margin-bottom: 20rpx;
					}
				}
			}

			&>.order-info {
				&>view {
					margin-bottom: 20rpx;
					height: 40rpx;

					text {
						letter-spacing: 0;
					}

					text:first-child {
						margin-right: 30rpx;
						color: rgba(64, 33, 16, 0.50);
					}
				}

				&>view:last-child {
					margin-bottom: 0rpx;
				}
			}
		}

		&>.fix-buttons {
			z-index: 10rpx;
			position: fixed;
			width: 100vw;
			height: 100rpx;
			bottom: 0;
			left: 0;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #FFFFFF;

			.fix-buttons2 {
				// width: 100vw;
				// height: 130rpx;
				display: flex;
				justify-content: space-around;
				align-items: center;
				// border: 1px solid;
			}

			.nullListMsg {
				position: absolute;
				right: 15%;
				bottom: 100%;
				// transform: translateX(-50%) translateY(-50%);
				text-align: center;
				z-index: 501;

				&>view:nth-child(1) {
					width: 420rpx;
					height: 64rpx;
					background: #000000;
					opacity: 0.5;
					border-radius: 10rpx;
					color: #ffffff;
					font-size: 24rpx;
					display: flex;
					align-items: center;
					justify-content: center;
				}

				&>view:nth-child(2) {
					width: 0;
					height: 0;
					border-left: 10rpx solid transparent;
					border-right: 10rpx solid transparent;
					border-top: 10rpx solid #000000;
					opacity: 0.5;
					position: fixed;
					left: 60%;
					transform: translateX(-50%);
				}
			}

			.zdy-ju-left {
				width: 160rpx;
				height: 60rpx;
				font-size: 28rpx;
				font-weight: 500;
				background: #FFFFFF;
				display: flex;
				justify-content: center;
				align-items: center;
				border-radius: 50rpx;
				color: rgb(120, 120, 120);
				// border: 1px solid #ccc;
			}

			.zdy-ju-right {
				width: 240rpx;
				height: 64rpx;
				font-size: 28rpx;
				font-weight: 500;
				background: #F39B19;
				display: flex;
				justify-content: center;
				align-items: center;
				border-radius: 50rpx;
				color: #fff;
				// border: 1px solid;
			}

			&>.button {
				flex: 1;
				font-size: 16px;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;

				&:active {
					opacity: 0.7;
				}
			}

			.button:nth-child(1) {
				// border: 1px solid rgba(64,33,16,0.50);
				// margin-right: 30rpx;
				color: rgba(64, 33, 16, 0.50);
			}

			.button:nth-child(2) {
				// border: 1px solid #F39B19;
				color: #FFFFFF;
				background-color: #F39B19;
			}

			.button:nth-child(3) {
				// border: 1px solid #F39B19;
				color: #F39B19;
			}

			&>.comment {
				width: 100%;
				border: 1px solid #F39B19 !important;
				color: #FFFFFF !important;
				background-color: #F39B19 !important;
			}
		}
	}

	.fg {
		font-size: 24rpx;
		color: #7F7F7F;
		line-height: 49rpx;
		margin: 0 20rpx;
	}

	.cx {
		font-size: 24rpx;
		font-weight: 400;
		color: #7F7F7F;
		line-height: 49rpx;

		&>text:nth-last-child(1) {
			color: #FE4B28;
			margin-left: 8rpx;
		}
	}

	.cxDiv {
		display: flex;
		flex-direction: row;
	}

	.sex-nan {
		width: 73rpx;
		height: 32rpx;
		background: #1CAAEA;
		border-radius: 4rpx;
		margin-left: 8rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 20rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 20rpx;
	}

	.sex-nv {
		width: 73rpx;
		height: 32rpx;
		background: #F90865;
		border-radius: 4rpx;
		margin-left: 8rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 20rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 20rpx;
	}

	.sex-image {
		width: 17rpx;
		height: 17rpx;
		margin-right: 9rpx;
	}

	.floorsstr-view {
		width: 184rpx;
		height: 34rpx;
		background: #FDE4E4;
		border-radius: 4rpx;
		font-size: 24rpx;
		font-weight: 500;
		color: #E62B00;
		line-height: 24rpx;
		margin-left: 12rpx;
		padding: 5rpx 12rpx;
	}

	.vip-crown {
		// width: 148rpx;
		padding: 0 10rpx;
		height: 32rpx;
		background: linear-gradient(0deg, #111832, #343B54);
		border-radius: 16rpx;
		position: absolute;
		top: 76rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;

		&>image {
			width: 28rpx;
			height: 28rpx;
			margin-right: 4rpx;
		}

		&>text {
			font-size: 20rpx;
			font-weight: 500;
			color: #FCC928;
			line-height: 32rpx;
		}
	}

	.avatar-pic-vip {
		width: 105rpx;
		height: 105rpx;
		border-radius: 50%;
		border: 3rpx solid #FCC928;
	}

	.vip-avatar {
		width: 130rpx;
		height: 130rpx;
		background-image: url(../../static/icon3/7868789.png);
		background-size: cover;
	}

	.avatar-pic-vip1 {
		width: 111rpx !important;
		height: 111rpx !important;
		border-radius: 50%;
		background: url('../../static/icon3/1.png') center center/cover no-repeat;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;

		.image {
			width: 95rpx !important;
			height: 95rpx !important;
			border-radius: 50% !important;
		}
	}

	.avatar-pic-vip2 {
		width: 111rpx !important;
		height: 111rpx !important;
		border-radius: 50%;
		background: url('../../static/icon3/2.png') center center/cover no-repeat;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;

		.image {
			width: 95rpx !important;
			height: 95rpx !important;
			border-radius: 50% !important;
		}
	}

	.avatar-pic-vip3 {
		width: 120rpx !important;
		height: 120rpx !important;
		border-radius: 50%;
		background: url('../../static/icon3/3.png') center center/cover no-repeat;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;

		.image {
			width: 70rpx !important;
			height: 70rpx !important;
			margin-top: 20rpx;
			border-radius: 50% !important;
		}
	}
</style>